[dotnet run] $(Device) global property missing during DeployToDevice target#53018
Open
jonathanpeppers wants to merge 1 commit intorelease/10.0.3xxfrom
Open
[dotnet run] $(Device) global property missing during DeployToDevice target#53018jonathanpeppers wants to merge 1 commit intorelease/10.0.3xxfrom
$(Device) global property missing during DeployToDevice target#53018jonathanpeppers wants to merge 1 commit intorelease/10.0.3xxfrom
Conversation
…ce` target When the `DeployToDevice` target runs, and you selected a device from the `dotnet run` device selection prompt, `$(Device)` is blank! This was because evaluation already occurred, so we have to invalidate the project, so it will occur in subsequent steps. I could reproduce this in a test, so this verifies it will remain fixed for the future.
rolfbjarne
approved these changes
Feb 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes dotnet run device deployment scenarios where the selected device wasn’t flowing into subsequent MSBuild target execution (notably DeployToDevice) because the project had already been evaluated before the device was chosen.
Changes:
- Invalidate the cached MSBuild evaluation in
RunCommandSelectorwheneverDevice(and optionallyRuntimeIdentifier) is applied so later targets re-evaluate with the updated global properties. - Strengthen run-device tests to assert
DeployToDevicelogs include the expectedDevice(andRuntimeIdentifierfor auto-selected devices).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Cli/dotnet/Commands/Run/RunCommand.cs |
Forces selector re-evaluation after setting Device so DeployToDevice sees updated global properties. |
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunSelectsDevice.cs |
Extends binlog assertions to validate DeployToDevice received/logged the selected Device/RuntimeIdentifier. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the
DeployToDevicetarget runs, and you selected a device from thedotnet rundevice selection prompt,$(Device)is blank!This was because evaluation already occurred, so we have to invalidate the project, so it will occur in subsequent steps.
I could reproduce this in a test, so this verifies it will remain fixed for the future.